import { Public } from '@/decorators/visit.decorator';
import { Controller, Delete, Get, Post, Query } from '@nestjs/common';
import { ApiBearerAuth, ApiOperation } from '@nestjs/swagger';
import { CarouselService } from './carousel.service';

@Controller('admin/carousel')
export class CarouselController {
  constructor(private readonly carouselService: CarouselService) {}

  @Public()
  @ApiOperation({
    summary: '轮播图列表查询',
  })
  @ApiBearerAuth()
  @Get('/carouselListSelect')
  carouselListSelect(@Query('page') page = 1, @Query('size') size = 10) {
    return this.carouselService.carouselListSelect({
      page: Number(page),
      size: Number(size),
    });
  }

  @Public()
  @ApiOperation({
    summary: '删除轮播图',
  })
  @ApiBearerAuth()
  @Delete('/deleteCarousel')
  deleteCarousel(@Query('id') id: number) {
    return this.carouselService.deleteCarousel(id);
  }
}
